// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: "2024-04-03",
  devtools: { enabled: false },
  srcDir: "src/", // 指定根目录
  ssr: true, // 开启服务端渲染
  typescript: {
    typeCheck: true,
    strict: false,
  },
  devServer: {
    port: 9999,
    host: "localhost",
  },
  css: ["~/assets/css/base.scss"], // 初始化样式
  vite: {
    css: {
      preprocessorOptions: {
        scss: {
          api: "modern-compiler", // 默认值为legacy，jsapi已弃用
          additionalData: `@use "~/assets/css/variable.scss" as *;`, // 引入变量
        },
      },
    },
  },
  modules: [
    "@element-plus/nuxt", // 导入element-plus组件库
    "@pinia/nuxt", // 导入pinia状态管理
    "pinia-plugin-persistedstate/nuxt", // 导入pinia持久化插件
  ],
  runtimeConfig: {
    // 全局变量，仅服务端访问
    count: 1,
    public: {
      // 全局变量，服务端/客户端都能访问
      API_BASE_DEV: "http://localhost:9998",
      API_BASE_PROD: "http://localhost:9998",
    },
  },
});
